/**
 * HopeBankProperty module
 */

import eventHelper from "../../../utils/EventHelper";
import editorWidget from "../../../actions/Editor/widgets";
import editorActions from "../../../actions/Editor/editor"
import {bindActionCreators} from 'redux';
import {connect} from 'dva';

var React = require("react");
var tool = require("../../../utils/tool");
var consts = require("../../../utils/consts");
var storage = require("../../../utils/storage");
var Validator = require("../../../utils/validator/Validator");
var CommonProperty = require("./CommonProperty");
var HopeBankProperty = React.createClass({
    mixins: [CommonProperty],
    getInitialState: function () {
        return {
            error: false,
            logo_url: "",
            show_brand: false,
            over_editor_cash: false,
            less_editor_cash: false,
            custom: 0,
            red_shared_can_again: 0,
            has_end_set: 1
        }
    },
    getInitialProps: function () {
        return {
            root: {},
            widget: {}
        }
    },
    componentWillMount: function () {
        var property = this.props.widget;
        this.setState({
            custom: parseInt(property.custom),
            red_shared_can_again: property.red_shared_can_again,
            has_end_set: property.has_end_set,
        })
        this.storeData = {};
        this.end_by_deadline = "";
        this.minDate = this.initMinDateTimeLocal();
        this.less_editor_by = false;

        // 红包默认尺寸
        this.defaultSize = {
            width: 147,
            height: 188
        };
        // 红包自定义尺寸
        this.customSize = {};
        this.typeMapping = {
            offset_x: "位置X",
            offset_y: "位置Y",
        };
        this.CONST = {
            PAPER_MAX_WIDTH: 1000,
            PAPER_WIDTH: window.is.CONST.editor_width
        };

        this.defaultScaleX = this.CONST.PAPER_MAX_WIDTH * property.width / this.CONST.PAPER_WIDTH;
        this.defaultScaleY = this.CONST.PAPER_MAX_WIDTH * property.height / this.CONST.PAPER_WIDTH;
    },
    // componentWillReceiveProps: function (nextProps){
    //     var data = nextProps.widget;
    //     // 记录自定义图片尺寸
    //     if (data.width !== this.defaultSize.width &&
    //         data.height !== this.defaultSize.height){
    //         this.customSize = {
    //             width: data.width,
    //             height: data.height
    //         };
    //     }
    // },
    openShowBrand: function () {
        this.setState({show_brand: !this.state.show_brand});
    },
    handleOnPropertyChange: function (e) {
        const {updateWidget, setState}=this.props;
        var data = this.props.selectedWidget;
        var input = $(e.target || e.srcElement);
        var type = input.attr("name"), val = input.val();

        var numberTypes = ["offset_x", "offset_y", "width", "height"];
        if (val && $.inArray(type, numberTypes) !== -1) {
            val = parseFloat(val);
        }
        // 同步3d中大小的更改
        var sizeTypes = ["width", "height"];
        if ($.inArray(type, sizeTypes) != -1) {
            data.sizeChanged = true;
        }

        // 锁定状态下处理宽高
        var ratio = parseFloat(147 / 188);
        if (type == 'width') {
            data.height = parseFloat(val / ratio) || 1;
        } else if (type == 'height') {
            data.width = parseInt(val * ratio).toFixed(0) || 1;
        }
        if (this.checkInputVaild(type, val)) {
            if ('red_total_cash' === type) {
                if (val > 200) {
                    val = 200;
                    this.setState({over_editor_cash: true});
                } else if (val < 5) {
                    this.setState({less_editor_cash: true});
                } else {
                    if (val != parseInt(val)) {
                        if (val.split('.') && val.split('.')[1].length > 2) {
                            val = p - arseFloat(parseInt(val) + "." + val.split('.')[1].slice(0, 2));
                        }
                    } else this.setState({less_editor_cash: false, over_editor_cash: false, error: false});
                }

            } else if ('end_by_deadline' === type) {
                // 转换时间用于后端存储
                val = this.changeUtcTime(val);
            }
            this.storeData = this.buildNewData(data, type, val);
            if ('red_total_cash' === type) this.storeData.end_by_least_account = this.reBulidEndByAccount(1, this.storeData);
            updateWidget(this.storeData);
            setState({selectedWidget: this.storeData});
        }
    },
    checkInputVaild: function (type, value, needAlert) {
        var validators = [];
        var validator = Validator();

        // 大小、位置、深度加入小数校验
        var nonDecimalTypes = ["offset_x", "offset_y", "offset_z", "width", "height"];
        if ($.inArray(type, nonDecimalTypes) != -1) {
            validators.push({validator: "nonDecimal"});
            validators.push({validator: type});

            validator.addRule(value, validators);

            var errors = validator.execute();
            errors && needAlert && (alert(errors));
        }
        return !errors;
    },
    handleOnInputBlur: function (type, e) {
        // const {updateWidget, setState,selectedWidget}=this.props;
        // var data = selectedWidget;
        // var input = $(e.target || e.srcElement);
        // var scaleTypes = ["width", "height"];
        // var mapping = {
        //     width: "scaleX",
        //     height: "scaleY"
        // }, default_mapping = {
        //     width: "defaultScaleX",
        //     height: "defaultScaleY"
        // };
        // if (input && input.length) {
        //     var val = input.val();
		//
        //     var numberTypes = ["width", "height", "offset_x", "offset_y"];
        //     if (val && $.inArray(type, numberTypes) !== -1) {
        //         val = parseFloat(val);
        //         if (type == 'radius') {
        //             val = val > 0 ? val || 0 : 0;
        //         }
        //     }
		//
        //     var sizeTypes = ["width", "height"];
        //     if ($.inArray(type, sizeTypes) !== -1) {
        //         // 同步3d下大小的变更
        //         data.sizeChanged = true;
        //     }
		//
        //     var endTypes = ["end_by_deadline"];
        //     if ($.inArray(type, endTypes) !== -1) {
        //         val = this.changeUtcTime(val);
        //     }
		//
        //     if (this.checkInputVaild(type, val, true)) {
        //         if ($.inArray(type, endTypes) !== -1) {
        //             data = this.storeData = this.buildNewData(data, type, val);
        //         } else {
        //             data = tool.rebuildWidgetData(data, type, val);
        //         }
        //         data.radius = data.radius == undefined ? 0 : data.radius;
        //         data.scale = data.scale || 1;
        //         data.is_saved = true;
        //         if ($.inArray(type, scaleTypes) != -1) {
        //             var defaultScale = this[default_mapping[type]] || 1;
        //             var scale = this.CONST.PAPER_MAX_WIDTH * val / this.CONST.PAPER_WIDTH;
        //             data[mapping[type]] = scale / defaultScale;
        //         }
        //         if (!tool.isEmptyObject(data)) {
        //             // 处理锁定状态下的宽高
        //             data.width = parseInt(data.width);
        //             data.height = parseInt(data.height);
        //             updateWidget(data);
        //             setState({selectedWidget: data});
        //         }
		//
        //         // var newWidget = $.extend(true, {}, data);
        //         // historyProvider.execute(new WidgetPropertyCommand(storage.data.page, oldWidget, newWidget, root, dataProvider));
        //     } else {
        //         // 恢复数据
        //         this.storeData.brand_name = this.storeData.brand_name || "幻视AR";
        //         updateWidget(this.storeData);
        //         // setState({selectedWidget: this.storeData});
        //         eventHelper.trigger(consts.EVENTS.THREED_WIDGET_PROPERTY_CHANGED, this.storeData);
        //     }
        // }
    },
    handleOnStatusChange: function (e) {
        const {updateWidget, setState}=this.props;
        var className = "info-item";
        var widget = this.props.selectedWidget;
        var element = $(e.target || e.srcElement);
        element = element.hasClass(className) ? element : element.parents("." + className);

        // name, custom ,red_shared_can_again
        var type = element.attr("name");
        var params = null;
        if ("custom" === type) {
            var custom = parseInt(element.attr("data-custom"));
            params = {
                custom: custom
            };
            // 默认样式
            // 恢复默认尺寸
            if (0 === custom) {
                params = $.extend({}, params, this.defaultSize);
                // 恢复自定义尺寸
            } else {
                params = $.extend({}, params, this.customSize);
            }
        } else if ("red_shared_can_again" === type) {
            params = {
                red_shared_can_again: !this.state.red_shared_can_again
            }
        } else if ("has_end_set" === type) {
            params = {
                has_end_set: !this.state.has_end_set
            }
        }
        this.setState(params);

        $.extend(widget, params);
        updateWidget(widget);

        widget.propertyChanged = true;
        eventHelper.trigger(consts.EVENTS.THREED_WIDGET_PROPERTY_CHANGED, widget);
    },
    handleOnChangePictureDialog: function (e) {
        var root = this.props.root;
        var className = "logo_md5_brand";
        var element = $(e.target || e.srcElement);
        // redBag brand logo upload
        if (element.hasClass(className)) {
            root.setState({is_logo_md5: true});
        }
        root.openDialog(consts.DIALOG_TYPE.UPLOAD_PICTURE);
    },
    buildNewData: function (data, type, val) {
        var newData = "{\"" + type + "\":\"" + val + "\"}";
        newData = JSON.parse(newData);

        return $.extend(true, data, newData);
    },
    reBuildDateTime: function () {
        var property = this.props.widget;
        if (!property.end_by_deadline) {
            property.end_by_deadline = this.initDateTimeLocal()[0];
            this.end_by_deadline = this.initDateTimeLocal()[1];
        } else {
            this.changeTime(property.end_by_deadline);
        }
        this.createDateTimePicker();
    },
    createDateTimePicker: function () {
        var date = new Date();
        var year = date.getFullYear(),
            month = date.getMonth(),
            day = date.getDate();
        var element = $(this.refs.datatime_local);
        console.log('datetimepicker is undefined')
        // element.datetimepicker({
        //     value: this.end_by_deadline,
        //     prevButton: false,
        //     nextButton: false,
        //     yearStart: year,
        //     monthStart: month,
        //     monthEnd: 11,
        //     minDate: new Date().toLocaleDateString(),
        // })
    },
    initMinDateTimeLocal: function () {
        var date = new Date();
        var year = date.getFullYear(),
            month = date.getMonth() + 1,
            day = date.getDate();
        month = month > 9 ? month : '0' + month;
        day = day > 9 ? day : '0' + day;
        var timeStr = '00:00';
        timeStr = year + '-' + month + '-' + day + 'T' + timeStr;
        return timeStr;
    },
    initDateTimeLocal: function () {// 初始化红包游戏结束时间
        var date = new Date();
        var year = date.getFullYear(),
            month = date.getMonth() + 1,
            day = date.getDate() + 2;
        var timeStr = '00:00';
        var targetTime = (new Date(year, month - 1, day)).getTime();
        var offsetTime = new Date().getTimezoneOffset() * 60000;
        var end_by_deadline = parseInt(targetTime + offsetTime) / 1000;
        month = month > 9 ? month : '0' + month;
        day = day > 9 ? day : '0' + day;
        timeStr = year + '/' + month + '/' + day + ' ' + timeStr;
        return [end_by_deadline, timeStr];
    },
    handleOnPropertyUpdate: function () {
        eventHelper.trigger(consts.EVENTS.THREED_WIDGET_PROPERTY_CHANGED, this.storeData);
    },
    changeTime: function (end_deadline) {// 转换时间前端显示
        var offsetTime = new Date().getTimezoneOffset() * 60000,
            total_sec = end_deadline * 1000 - offsetTime,//总毫秒数
            newTime = new Date(total_sec),
            year = newTime.getFullYear(),
            month = (newTime.getMonth() + 1).toString(),
            date = newTime.getDate().toString(),
            hour = newTime.getHours().toString(),
            min = newTime.getMinutes().toString(),
            sec = newTime.getMilliseconds().toString();
        month = month.length > 1 ? month : '0' + month;
        date = date.length > 1 ? date : '0' + date;
        hour = hour.length > 1 ? hour : '0' + hour;
        min = min.length > 1 ? min : '0' + min;
        sec = sec.length > 1 ? sec : '0' + sec;
        var timeStr = year + '/' + month + '/' + date + ' ' + hour + ':' + min;
        this.end_by_deadline = timeStr;
    },
    changeUtcTime: function (end_deadline) {// 前端显示时间转换成后端存储格式
        if (!end_deadline) return;
        var localDate = new Date(),
            localYear = localDate.getFullYear(),
            localMonth = localDate.getMonth() + 1,
            localDate = localDate.getDate();
        var timeStr = end_deadline.split(" "),
            date = timeStr[0].split("/"),
            time = timeStr[1].split(":"),
            year = parseInt(date[0]) < localYear || parseInt(date[0]) > 9999 ? localYear : parseInt(date[0]),
            hour = parseInt(time[0]) || 0,
            min = parseInt(time[1]) || 0,
            month = parseInt(date[1]),
            day = parseInt(date[2]);
        var targetTime = (new Date(year, month - 1, day, hour, min)).getTime();//毫秒
        var offsetTime = new Date().getTimezoneOffset() * 60000;//毫秒
        var end_by_deadline = parseInt((targetTime + offsetTime) / 1000);//秒

        return end_by_deadline;
    },
    reBulidEndByAccount: function (type, data) {
        var property = data;
        var end_account = property.end_by_least_account || property.red_total_cash;
        end_account = parseFloat(end_account);

        if (end_account < parseFloat(property.red_total_cash)) {
            end_account = property.red_total_cash;
            if (type) this.less_editor_by = true;
        } else this.less_editor_by = false;
        return end_account;
    },
    render: function () {
        const status=this.state;
        var property = this.props.selectedWidget;
//        property.has_end_set = property.has_end_set == undefined ? 1 : property.has_end_set;
        property.custom = parseInt(property.custom) || 0;
//        this.reBuildDateTime();
        var lan = storage.data.lan;
        var numberTypeErrorNode = "";
        if (status.error) {
            numberTypeErrorNode =
                <div style={{color:'#ff0000'}}>{$._("Enter an integer or two decimal places")}</div>
        }
        var numberCashOverErrorNode = "";
        if (status.over_editor_cash) {
            numberCashOverErrorNode =
                <div style={{color:'#ff0000'}}>{$._("Single red total maximum set 10000")}</div>
        }
        var numberCashLessErrorNode = "";
        if (status.less_editor_cash) {
            numberCashLessErrorNode =
                <div style={{color:'#ff0000'}}>{$._('Single red total minimum set 5')}</div>
        }
        var delayTimeNode = "";
        if (property.auto_play == 1) {
            delayTimeNode =
                <div className="rowlist delay_time">
                    <label className="pull-left">{$._("Delay time")}</label>
                    <input type="range" min='0' max="60" step="1" value={property.start_time} name='start_time'
                           onChange={this.handleOnPropertyChange}
                           onBlur={this.handleOnInputBlur.bind(this, "start_time")} id='red_start_time'/>
                    <div className="delay_timediv">
                        <span>{property.start_time}</span>
                        <span>s</span>
                    </div>
                </div>
        }

        if (!property.auto_play) {
            var rowListImgNode = "";
            if (!property.custom) {
                rowListImgNode =
                    <div className="text-center">
                        <div className="red_default_btn">{$._('Start to grab a red envelope')}</div>
                    </div>
            }

            var rowListButtonNode = "";
            //　上传后的样式
            var uploadedStyle = {
                background: "url(" + (property.url || "") + ") no-repeat center",
                backgroundSize: "cover"
            };
            if (property.custom) {
                rowListButtonNode =
                    <div type="button" tabIndex="-1" className="red_style custom-image-btn-img"
                         onClick={this.handleOnChangePictureDialog} id='red_style' style={uploadedStyle}>
                        <span className={property.url ? 'uploadedStyle': ""}>{$._("Upload custom image")}</span>
                    </div>
            }
            var rowListNode = "";
            rowListNode =
                <div className="rowlist">
                    <div className="game_btn_title">{$._('Game trigger button style')}</div>
                    <div className="standard">
                        <div className={"info-item " +(!property.custom ? "activebtn" : "noactivebtn")}
                             onClick={this.handleOnStatusChange} name='custom' data-custom='0' id='red_change_custom'>
                            <span>{$._("Default style")}</span>
                        </div>
                        <div className={"info-item " +(property.custom ? "activebtn" : "noactivebtn")}
                             onClick={this.handleOnStatusChange} name='custom' data-custom='1' id='red_change_custom1'>
                            <span>{$._("Custom")}</span>
                        </div>
                    </div>
                    {rowListImgNode}
                    {rowListButtonNode}
                </div>
        }

        var propertyLogoImgNode = "";
        if (property.logo_url) {
            propertyLogoImgNode =
                <img src={property.logo_url} className='logo_md5_brand' onClick={this.handleOnChangePictureDialog}
                     id='logo_brand_upload'/>
        }

        var logoMd5ImgNode = "";
        if (!property.logo_md5) {
            logoMd5ImgNode =
                <img src='/static/idealsee/images/new_editor/editor/logo_img.png' className='logo_md5_brand'
                     onClick={this.handleOnChangePictureDialog} id='defalut_brand_upload'/>
        }

        var showBrandNode = "";
        if (status.show_brand) {
            showBrandNode =
                <div className="show_brand" onClick={this.openShowBrand}>
                    <img src="/static/idealsee/images/new_editor/editor/7.jpg" height="480"/>
                </div>
        }
        var lessRedNode = "";
        if (this.less_editor_by) {
            lessRedNode = <div className='red_tips'
                               style={{color:'#FF0000'}}>{$._("Modified for the total amount of the current red")}</div>
        } else {
            lessRedNode = <div className='red_tips'>{$._('Need more than red total amunt')}</div>
        }
        var endGameNode = "";
        if (property.has_end_set) {
            endGameNode = <div className='has_end_set'>
                <div className="rowlist">
                    <label>{$._('Account is less than')}</label>
                    <input type="number" min={property.red_total_cash} step="1" className='form-control common_width'
                           value={property.end_by_least_account || 0} name='end_by_least_account'
                           onChange={this.handleOnPropertyChange}
                           onBlur={this.handleOnInputBlur.bind(this, "end_by_least_account")} id='end_by_least_account'
                           style={{width: lan == 'ja_JP' ? '130px': '140px'}}/>
                    {lessRedNode}
                </div>
                <div className="rowlist">
                    <label style={{marginRight:'0px',marginTop:'2px'}}>{$._("Time over")}</label>
                    <input type="text" className='form-control pull-right' value={this.end_by_deadline}
                           onChange={this.handleOnPropertyChange}
                           onBlur={this.handleOnInputBlur.bind(this, "end_by_deadline")} name='end_by_deadline'
                           min={this.minDate} ref="datatime_local" id='end_by_deadline' readOnly/>
                </div>
                <div className="rowlist">
                    <div className="red_tips">{$._('The redBag open condition')}</div>
                </div>
            </div>
        }

        return (
            <form noValidate className="property-container property" name="form.name">
                <div className="redbag">
                    <header>{$._("Property")}</header>
                    <div className="redBag">
                        <div className="rowlist position_red">
                            <label>{$._("Size")}</label>
                            <input name="width" onChange={this.handleOnPropertyChange}
                                   onBlur={this.handleOnInputBlur.bind(this, "width")} data-number type="number"
                                   value={property.width || 0} className='form-control'/>
                            <input name="height" onChange={this.handleOnPropertyChange}
                                   onBlur={this.handleOnInputBlur.bind(this, "height")} data-number type="number"
                                   value={property.height || 0} className='form-control'/>
                            <span className="position position-x">w</span>
                            <span className="position position-y">h</span>
                        </div>
                        <div className="rowlist position_red">
                            <label>{$._("Position")}</label>
                            <input name="offset_x" data-number type="number" value={property.offset_x || 0}
                                   className='form-control' onChange={this.handleOnPropertyChange}
                                   onBlur={this.handleOnInputBlur.bind(this, "offset_x")} id='red_offset_x'/>
                            <input name="offset_y" data-number type="number" value={property.offset_y || 0}
                                   className='form-control' style={{marginRight:'0px'}}
                                   onChange={this.handleOnPropertyChange}
                                   onBlur={this.handleOnInputBlur.bind(this, "offset_y")} id='red_offset_y'/>
                            <span className="position position-x">x</span>
                            <span className="position position-y">y</span>
                        </div>
                        <div className='rowlist row_offset_z'>
                            <label>{$._("Offset_z")}</label>
                            <input name="offset_z" onChange={this.handleOnPropertyChange}
                                   onBlur={this.handleOnInputBlur.bind(this, "offset_z")} type="number"
                                   value={property.offset_z || 0} className='form-control' style={{width:'80px'}}/>
                        </div>
                        <div className="rowlist">
                            <label>{$._("Single game time")}</label>
                            <select className="common_width" value={property.red_game_duration} name='red_game_duration'
                                    onChange={this.handleOnPropertyChange}
                                    onBlur={this.handleOnInputBlur.bind(this, "red_game_duration")}
                                    id='red_game_duration'>
                                <option value="30">30s</option>
                                <option value="45">45s</option>
                                <option value="60">60s</option>
                                <option value="75">75s</option>
                                <option value="90">90s</option>
                                <option value="120">120s</option>
                            </select>
                        </div>
                        <div className="rowlist">
                            <label>{$._('Single redBag number')}</label>
                            <select className="common_width" value={property.red_packet_count} name='red_packet_count'
                                    onChange={this.handleOnPropertyChange}
                                    onBlur={this.handleOnInputBlur.bind(this, "red_packet_count")}
                                    id='red_packet_count'>
                                <option value="10">10{$._("individual")}</option>
                                <option value="20">20{$._("individual")}</option>
                                <option value="30">30{$._("individual")}</option>
                                <option value="40">40{$._("individual")}</option>
                                <option value="50">50{$._("individual")}</option>
                                <option value="60">60{$._("individual")}</option>
                                <option value="70">70{$._("individual")}</option>
                                <option value="80">80{$._("individual")}</option>
                                <option value="90">90{$._("individual")}</option>
                                <option value="100">100{$._("individual")}</option>
                            </select>
                        </div>
                        <div className="rowlist">
                            <label>{$._('Single red total')}</label>
                            <input type="number" min="5" step="1" max='10000' className='form-control common_width'
                                   value={property.red_total_cash || 0} name='red_total_cash'
                                   onChange={this.handleOnPropertyChange}
                                   onBlur={this.handleOnInputBlur.bind(this, "red_total_cash")} id='red_total_cash'/>
                            {numberTypeErrorNode}
                            {numberCashOverErrorNode}
                            {numberCashLessErrorNode}
                        </div>
                        <div className="rowlist">
                            <label>{$._('RedBag distribution mode')}</label>
                            <select className="common_width" value={property.red_allot} name='red_allot'
                                    onChange={this.handleOnPropertyChange}
                                    onBlur={this.handleOnInputBlur.bind(this, "red_allot")} id='red_allot'
                                    style={{width: lan == 'ja_JP' ? '162px': '140px'}}>
                                <option value="1">{$._('Random amount')}</option>
                                <option value="2">{$._('Average amount')}</option>
                            </select>
                        </div>
                        <div className="rowlist">
                            <label>{$._('Difficulty in winning')}</label>
                            <select style={{width: lan == 'ja_JP' ? '175px': '165px'}} value={property.red_ratio}
                                    name='red_ratio' onChange={this.handleOnPropertyChange}
                                    onBlur={this.handleOnInputBlur.bind(this, "red_ratio")} id='red_ratio'>
                                <option value="0">{$._('Easy')}</option>
                                <option value="1">{$._('commonly')}</option>
                                <option value="2">{$._('A bit difficult')}</option>
                                <option value="3">{$._('Difficult')}</option>
                            </select>
                        </div>
                        <div className="rowlist">
                            <label>{$._('Qualification frequency setting')}</label>
                            <select className="common_width" value={property.red_auth_age} name='red_auth_age'
                                    onChange={this.handleOnPropertyChange}
                                    onBlur={this.handleOnInputBlur.bind(this, "red_auth_age")} id='red_auth_age'
                                    style={{width: lan == 'ja_JP' ? '164px': '140px'}}>
                                <option value="0">{$._("one times")}</option>
                                <option value="1">{$._("threed times")}</option>
                                <option value="2">{$._("one day one times")}</option>
                                <option value="3">{$._("one day threed times")}</option>
                            </select>
                            <div className='red_tips'>{$._('the number of games can be played')}</div>
                        </div>
                        <div className="rowlist">
                            <div>
                                <label className="pull-left">{$._('Share can be added once')}</label>
                                <div
                                    className={"red_share info-item " + (property.red_shared_can_again ? "icon-uniF52F" : "icon-uniF471")}
                                    name='red_shared_can_again' value={property.red_shared_can_again}
                                    onClick={this.handleOnStatusChange} id='red_shared_can_again'></div>
                            </div>
                            <div className='red_tips'>{$._('One account to share only after a game')}</div>
                        </div>
                        {delayTimeNode}
                        {rowListNode}
                    </div>
                </div>
            </form>
        )
    }
});
const mapStateToProps = ({editor}) => {
    return editor;
};

const mapDispatchToProps = (dispatch) => {
    return bindActionCreators({...editorActions, ...editorWidget}, dispatch);
};


export default connect(mapStateToProps, mapDispatchToProps)(HopeBankProperty);
